package com.flying.utils.bean;

import com.flying.utils.collection.MapUtil;
import com.flying.utils.exception.LoggableRuntimeException;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

public final class BeanUtil {
    public static String describe(Object bean) {
        try {
            return MapUtil.asString(BeanUtils.describe(bean));
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
            throw new LoggableRuntimeException(e.getMessage(), e);
        }
    }
}
